const { contextBridge, ipcRenderer } = require('electron')

contextBridge.exposeInMainWorld('khj', {
  puppeteer: {
    connect: () => ipcRenderer.invoke('puppeteer:connect'),
    screenshot: () => ipcRenderer.invoke('puppeteer:screenshot'),
    getWebview: () => ipcRenderer.invoke('puppeteer:getWebview'),
    test111: (config) => ipcRenderer.invoke('puppeteer:test111', JSON.parse(config)),
    test222: (config) => ipcRenderer.invoke('puppeteer:test222', JSON.parse(config)),
    commentListUpdate: (data) => ipcRenderer.on('comment-list-update', data),
    giveALike: (config) => ipcRenderer.invoke('douyin:comment:giveALike', JSON.parse(config)),
    comment: (config) => ipcRenderer.invoke('douyin:comment:comment', JSON.parse(config)),
    commentSucceed: (config) => ipcRenderer.on('comment-publish-succeed', config),
    goHomePage: (config) => ipcRenderer.invoke('douyin:home:page', JSON.parse(config)),
    follow: (config) => ipcRenderer.invoke('douyin:home:follow', JSON.parse(config)),
    privateMessage: (config) => ipcRenderer.invoke('douyin:home:privateMessage', JSON.parse(config))
  }
}) 